//
//  XYJLoginViewController.m
//  徙游记-01
//
//  Created by hcios on 2017/7/21.
//  Copyright © 2017年 鹿林. All rights reserved.
//

#import "XYJLoginViewController.h"
#import "XYJTabBarViewController.h"
#import "XYJMineViewController.h"
#import "WSRollView.h"

@interface XYJLoginViewController ()<UITextFieldDelegate,UIGestureRecognizerDelegate>

@property (weak, nonatomic) IBOutlet UIView *backView;

@property (weak, nonatomic) IBOutlet UITextField *emailText;

@property (weak, nonatomic) IBOutlet UITextField *passwordText;

@property (weak, nonatomic) IBOutlet UIButton *loginBtn;

@property (weak, nonatomic) IBOutlet UIButton *weChatBtn;

@property (weak, nonatomic) IBOutlet UIButton *qqBtn;

@property (weak, nonatomic) IBOutlet UIButton *weiBoBtn;


@end

@implementation XYJLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = RGB(200, 200, 200);
    self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    _loginBtn.layer.cornerRadius = 20;
    _loginBtn.layer.masksToBounds = YES;
    _backView.layer.cornerRadius = 10;
    _backView.layer.masksToBounds = YES;
    
    //添加手势，点击屏幕其他区域关闭键盘的操作
    UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)];
    gesture.numberOfTapsRequired = 1;
    gesture.delegate = self;
    [self.view addGestureRecognizer:gesture];
    //添加背景图片
    WSRollView * wsRoll = [[WSRollView alloc] initWithFrame:RECT_MAKE(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    wsRoll.backgroundColor = [UIColor whiteColor];
    wsRoll.timeInterval = 0.01; //每次移动的时间
    wsRoll.rollSpace = 0.5; //每次移动的像素距离
    wsRoll.image = [UIImage imageNamed:@"111.jpg"];//本地图片
    //    wsRoll.rollImageURL = @"";//网络图片
    [wsRoll startRoll];
    [self.view addSubview:wsRoll];
    [self.view sendSubviewToBack:wsRoll];
}




#pragma mark - 键盘操作
-(void)hideKeyboard{
    [_emailText resignFirstResponder];
    [_passwordText resignFirstResponder];
}



- (IBAction)loginWeChat:(id)sender {
    
    NSLog(@"点击微信");
    [self alter];
}



- (IBAction)loginQQ:(id)sender {
    
    NSLog(@"点击qq");
    [self alter];
}



- (IBAction)loginWeiBo:(id)sender {
    
    NSLog(@"点击微博");
    [self alter];
}


- (IBAction)loginBtn:(id)sender {
    
    NSLog(@"点击登录");
    XYJTabBarViewController *VC = [[XYJTabBarViewController alloc] init];
    [self presentViewController:VC animated:YES completion:nil];
                                   
}



-(void)alter{
    UIAlertController *alter = [UIAlertController alertControllerWithTitle:@"提示" message:@"该功能未完成，尽请期待" preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction *action = [UIAlertAction actionWithTitle:@"知道了" style:UIAlertActionStyleDefault handler:nil];
    
    [alter addAction:action];
    
    [self.navigationController presentViewController:alter animated:YES completion:nil];
}

@end
